const express = require('express');
const app = express();
app.get('/',(req,res)=>{
    res.send('hello world')

    console.log(req.headers)
    console.log(req.host)
    console.log(req.method)
    console.log(req.httpVersion)
})

const Router = express.Router();
Router.get('/add',(req,res)=>{

    console.log(req.headers)
    console.log(req.host)
    console.log(req.method)
    console.log(req.url)
    console.log(req.query)
    console.log(req.httpVersion)
    let html = `<style>td{padding:10px;}</style><table width="100%">
    <tr><td>2</td><td>2</td><td>2</td></tr>
    <tr><td>2</td><td>2</td><td>2</td></tr>
    <tr><td>2</td><td>2</td><td>2</td></tr>
    <tr><td>2</td><td>2</td><td>2</td></tr>
    </table>`
    res.send(html)
})
app.use('/api',Router);

app.listen('3000',()=>{
    console.log('listen at http://localhost:3000')
})